package com.kedacom.freedomLabel.adapter;

import android.databinding.ViewDataBinding;

import com.kedacom.freedomLabel.R;
import com.kedacom.freedomLabel.databinding.ItemCategoryLayoutBinding;
import com.kedacom.freedomLabel.model.bean.Category;
import com.kedacom.freedomLabel.model.db.Converters;
import com.kedacom.lego.adapter.recyclerview.LegoBaseRecyclerViewAdapter;

import java.util.List;

/**
 * @author licheng
 * @since 2019/11/21 13:26
 */
public class CategoryAdapter extends LegoBaseRecyclerViewAdapter<Category> {

    public CategoryAdapter(List<Category> data) {
        super(R.layout.item_category_layout, data, com.kedacom.freedomLabel.BR.category);
    }

    @Override
    protected void onCustomBindItem(ViewDataBinding binding, int position) {
        ItemCategoryLayoutBinding itemBinding = (ItemCategoryLayoutBinding) binding;
        String[] columnNames = getData().get(position).columnNames;
        String columnNamesToString = Converters.columnNamesToString(columnNames);
        itemBinding.itemCategoryContent.setText(columnNamesToString);
    }
}